<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%> 
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<!-- meta tags, link to css:  -->
	<%@ include file="../jsp-includes/mymetaheader.jsp" %>
	<!--  Ajax-Includes -->
    <script type='text/javascript' src='/GroupMe/dwr/interface/DWRUserManager.js'></script>
    <script type='text/javascript' src='/GroupMe/dwr/engine.js'></script>
    <script type='text/javascript' src='/GroupMe/dwr/util.js'></script>

	<title>GroupMe! - The Social Semantic Web [Bookmarklet]</title>
</head>
<body>
	<!-- title image, logo:  -->
	<div id="bookmarklet_header">
		<img src="<%= request.getContextPath() %>/images/groupme-logo.png" style="text-decoration:none;border:none;" alt="GroupMe!"/>
	</div>
	<!-- Menu: -->
	<div id="bookmarklet_menu">
		<div style="margin-left: auto; margin-right: auto; max-width:700px; font-size:0.9em;">
			<i>Add web content to your GroupMe! groups...</i>
		</div>
	</div>
	<div>
	</div>
	<!-- content and sidebar -->
	<div id="bookmarklet_main">

		<!-- Content: -->
		<div id="contentSmallWindow">
		<br />
		<h3>Add something to your group(s)</h3>
		<br />
		<c:choose>
		<c:when test="${userManager.loggedIn}">
			
			<form action="<%= VIEW_VOCABULARY.GROUPME_BASE_URL + VIEW_VOCABULARY.ACTION_ADD_TO_GROUP %>" method="post"> 
			<table>
				<tr>
					<td><strong>Title:</strong></td> <td><input size="80" style="width: 100%" type="text" name="<%= VIEW_VOCABULARY.PARAMETER_TITLE %>" value="<c:out value='${title}' />"/></td>
				</tr>
				<tr>
					<td><strong>URL: </strong></td><td> <input size="80" style="width: 100%" type="text" name="<%= VIEW_VOCABULARY.PARAMETER_URL %>" value="<c:out value='${url}' />"/></td>
				</tr>
				<tr>
					<td><strong>Tags: </strong></td><td> <input size="80" style="width: 100%" type="text" name="<%= VIEW_VOCABULARY.PARAMETER_TAGS %>"/></td>
				</tr>
				<tr>
					<td></td><td style="color: gray"> <i>Separate tags with spaces. Enclose multi-word tags in "quotes", e.g.: "semantic web" w3c. </i></td>
				</tr>
				<tr>
					<td><strong>Description: </strong> <br/></td><td><textarea style="width: 100%" rows="3" name="<%= VIEW_VOCABULARY.PARAMETER_DESCRIPTION %>"></textarea></td>
				</tr>
				<tr><td><strong>Select group(s):</strong></td>
					<td>
						<select name="<%= VIEW_VOCABULARY.PARAMETER_GROUP %>" multiple="multiple" size="5" >
							<option selected="selected" value ="<%= VIEW_VOCABULARY.GROUP_QUEUE %>">I'm not sure. I'll decide this later.</option>
							
							<c:forEach items="${userManager.user.groups}" var="group" varStatus="status">
								<option value ="<c:out value='${group.id}' />"><c:out value='${group.name}' /></option>
							</c:forEach>
						</select>
					</td>
				</tr>
				<tr>
					<td></td><td> <input type="submit" value="add" /> </td>
				</tr>
			</table>
			</form>
			
		</c:when>
		<c:otherwise>
		<h4>Login</h4>
		<br />
			<form name="login" action="<%= VIEW_VOCABULARY.GROUPME_BASE_URL + VIEW_VOCABULARY.ACTION_LOGIN %>" method="post">
				<input  type="hidden" name="<%= VIEW_VOCABULARY.PARAMETER_ACTION %>" value="<%= VIEW_VOCABULARY.ACTION_LOGIN_VIA_BOOKMARKLET %>"/>
				<input  type="hidden" name="<%= VIEW_VOCABULARY.PARAMETER_TITLE %>" value="<c:out value='${title}' />"/>
				<input  type="hidden" name="<%= VIEW_VOCABULARY.PARAMETER_URL %>" value="<c:out value='${url}' />"/>
				<table>
					<tr>
						<td>username: </td>
						<td><input type="text" name="<%= VIEW_VOCABULARY.PARAMETER_USERNAME %>" value="<c:out value='${username}'/>"/></td>
					</tr>
					<tr>
						<td>password:</td> <td><input type="password" name="<%= VIEW_VOCABULARY.PARAMETER_PASSWORD %>"/> </td>
					</tr>
					<tr>
						<td style="text-align: left;"> </td>
						<td style="text-align: right;"><input type="checkbox" name=""/>&nbsp;&nbsp;<i>remember me</i></td>
					</tr>
					<tr>
						<td></td>
						<td style="text-align: right;"><input type="submit" value="login"/> </td>
					</tr>
				</table>
			</form>
			<span id="loginmessage">
				<font color="red"><c:out value="${loginstatus}"/></font>
			</span>
		</c:otherwise>
		</c:choose>
		</div>
	</div>
	
	<div id="bookmarklet_footer">
		<%@ include file="../jsp-includes/footer.jsp" %>
	</div>
</body>
</html>